import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
import config from '@/config'
const { cookieExpires } = config
export function getToken () {
  const token = Cookies.get(TokenKey)
  if (token) return token
  else return false
  // return localStorage.getItem(TokenKey)
}
export function setToken (token) {
  Cookies.set(TokenKey, token, {expires: cookieExpires || 1})
  // return localStorage.setItem(TokenKey, token)
}
export function removeToken () {
  // localStorage.removeItem('userInfo')
  // return localStorage.removeItem(TokenKey)
  setToken('')
}
export function setUserData (data) {
  return localStorage.setItem('userInfo', data)
}
